﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;

namespace WebApiSelfHost
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri baseAddress = new Uri("http://localhost:8008");

            HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(baseAddress);
            
            WebApiConfig.Register(config);            

            HttpSelfHostServer server = new HttpSelfHostServer(config);
            Task task = server.OpenAsync();
            task.Wait();

            Console.WriteLine("Server is up and running.");
            Console.WriteLine("Server listening on : {0}", baseAddress.ToString());
            Console.WriteLine("To close, press any key.");
            Console.ReadLine();
        }
    }
}
